Micron Document
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
| SparkN0de-git | SparkN0de |
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------


Commit 5b1c910f1f10d2e3d4044dc39e6fcf2904927932


Parents : 7a89c3e
Author : Mark Qvist <mark@unsigned.io>
Date : 2025-11-10T02:13:14+01:00

Fixed call log saving when identity could not be resolved

Changes

3 files changed, 35 insertions(+), 32 deletions(-)


Diff

diff --git a/sbapp/sideband/core.py b/sbapp/sideband/core.py
index 38d7febc..589476c9 100644
--- a/sbapp/sideband/core.py
+++ b/sbapp/sideband/core.py
@@ -5583,15 +5583,15 @@ class SidebandCore():
def incoming_call(self, remote_identity):
display_name = self.voice_display_name(remote_identity.hash)
self.setstate("voice.incoming_call", display_name)
- if self.gui_foreground(): RNS.log("Squelching call notification since GUI is in foreground", RNS.LOG_DEBUG)
- else: self.notify(title="Incoming voice call", content=f"From {display_name}", group="LXST.Telephony", context_id="incoming_call")
+ if self.gui_foreground() and self.getstate("app.displaying") == "voice_screen": RNS.log("Squelching call notification since voice screen is active", RNS.LOG_DEBUG)
+ else: self.notify(title="Incoming call", content=f"From {display_name}", group="lxst.telephony.call", context_id="incoming_call")
def missed_call(self, remote_identity):
display_name = self.voice_display_name(remote_identity.hash)
- self.setstate("voice.incoming_call", display_name)
+ self.setstate("voice.missed_call", display_name)
# if self.gui_foreground(): RNS.log("Squelching call notification since GUI is in foreground", RNS.LOG_DEBUG)
# else: self.notify(title="Missed voice call", content=f"From {display_name}", group="LXST.Telephony", context_id="incoming_call")
- self.notify(title="Missed voice call", content=f"From {display_name}", group="LXST.Telephony", context_id="incoming_call")
+ self.notify(title="Missed call", content=f"From {display_name}", group="lxst.telephony.call", context_id="incoming_call")
rns_config = """# This template is used to generate a
# running configuration for Sideband's

diff --git a/sbapp/sideband/voice.py b/sbapp/sideband/voice.py
index d2715525..07e40049 100644
--- a/sbapp/sideband/voice.py
+++ b/sbapp/sideband/voice.py
@@ -136,35 +136,36 @@ class ReticulumTelephone():
return self.call_log
def log_call(self, event, identity):
- RNS.log(f"Logging call event {event} for {RNS.prettyhexrep(identity.hash)}", RNS.LOG_DEBUG)
- if self.logpath:
- try:
- if not os.path.isfile(self.logpath):
- try:
- with open(self.logpath, "wb") as logfile: logfile.write(msgpack.packb([]))
- except Exception as e: raise OSError("Could not create call log file")
-
- call_log = []
- read_call_log = []
+ if identity:
+ RNS.log(f"Logging call event {event} for {RNS.prettyhexrep(identity.hash)}", RNS.LOG_DEBUG)
+ if self.logpath:
try:
- with open(self.logpath, "rb") as logfile: read_call_log = msgpack.unpackb(logfile.read())
- except Exception as e:
- RNS.log(f"Error while reading call log file: {e}", RNS.LOG_ERROR)
- RNS.log(f"Call log file will be re-created", RNS.LOG_ERROR)
+ if not os.path.isfile(self.logpath):
+ try:
+ with open(self.logpath, "wb") as logfile: logfile.write(msgpack.packb([]))
+ except Exception as e: raise OSError("Could not create call log file")
+
+ call_log = []
+ read_call_log = []
+ try:
+ with open(self.logpath, "rb") as logfile: read_call_log = msgpack.unpackb(logfile.read())
+ except Exception as e:
+ RNS.log(f"Error while reading call log file: {e}", RNS.LOG_ERROR)
+ RNS.log(f"Call log file will be re-created", RNS.LOG_ERROR)
- for entry in read_call_log:
- age = time.time()-entry["time"]
- if age < self.CALL_LOG_KEEP: call_log.append(entry)
+ for entry in read_call_log:
+ age = time.time()-entry["time"]
+ if age < self.CALL_LOG_KEEP: call_log.append(entry)
- entry = {"time": time.time(), "event": event, "identity": identity.hash}
- call_log.append(entry)
+ entry = {"time": time.time(), "event": event, "identity": identity.hash}
+ call_log.append(entry)
- with open(self.logpath, "wb") as logfile: logfile.write(msgpack.packb(call_log))
- self.call_log = call_log
+ with open(self.logpath, "wb") as logfile: logfile.write(msgpack.packb(call_log))
+ self.call_log = call_log
- except Exception as e:
- RNS.log(f"An error occurred while updating call log: {e}", RNS.LOG_ERROR)
- RNS.trace_exception(e)
+ except Exception as e:
+ RNS.log(f"An error occurred while updating call log: {e}", RNS.LOG_ERROR)
+ RNS.trace_exception(e)
def dial(self, identity_hash):
self.last_dialled_identity_hash = identity_hash

diff --git a/sbapp/ui/voice.py b/sbapp/ui/voice.py
index a71d948f..0f0e32ed 100644
--- a/sbapp/ui/voice.py
+++ b/sbapp/ui/voice.py
@@ -165,10 +165,12 @@ class Voice():
toast("Path request timed out")
def log_dial_action(self, sender=None):
- if sender:
- self.screen.ids.identity_hash.text = RNS.hexrep(sender.identity, delimit=False)
- self.dial_target = sender.identity
- self.dial_action()
+ if sender and self.app.sideband.voice_running and self.app.sideband.telephone != None:
+ telephone = self.app.sideband.telephone
+ if not telephone.is_ringing and not telephone.is_in_call and not telephone.call_is_connecting:
+ self.screen.ids.identity_hash.text = RNS.hexrep(sender.identity, delimit=False)
+ self.dial_target = sender.identity
+ self.dial_action()
def reject_action(self, sender=None):
if self.app.sideband.voice_running:


──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────